INCLUDE_DIRS := -Itree -Istring
BUILD_FLAGS := -ansi -O2 -pipe -funsigned-char $(INCLUDE_DIRS)
WARNING_FLAGS := -Wall -Wextra -Wconversion -Wtraditional-conversion -Werror -pedantic-errors

BUILD_DIR := ../build
OBJECTS := $(patsubst %.c, $(BUILD_DIR)/%.o, $(wildcard *.c))
CXX := gcc -c $(BUILD_FLAGS) $(WARNING_FLAGS) -o $(BUILD_DIR)/

build: $(OBJECTS) | $(BUILD_DIR)
	gcc -o $(BUILD_DIR)/trender $(OBJECTS)

$(BUILD_DIR)/trending.o: trending.o
	$(CXX)trending.o trending.c

$(BUILD_DIR)/istrcmp.o: istrcmp.o string/istrcmp.h
	$(CXX)istrcmp.o istrcmp.c

$(BUILD_DIR):
	mkdir $(BUILD_DIR)

.PHONY: clean
clean:
	rm -f $(OBJECTS)
